package com.company;

import java.io.File;
import java.util.Scanner;

public class iotest03 {

    public static void main(String[] args){
        {System.out.println("删除目标文件夹");}
        String dirpath=new Scanner(System.in).nextLine();
        File dir=new File(dirpath);
        String[] str=dir.list();
        sanchu(dir);

        System.out.println("目标文件夹已删除");
    }
    public static void sanchu(File dir){

        File[] fs=dir.listFiles();

        for (int i=0;i<fs.length;i++){
            if (fs[i].isFile()){
                fs[i].delete();
            }else if (fs[i].isDirectory()){
                sanchu(fs[i]);
            }
        }
        dir.delete();
    }
}
